<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>验证</title>
	<script src="https://cdn.dingxiang-inc.com/ctu-group/captcha-ui/index.js"></script>
	<style>
		#dx {
			margin: 0 auto;
		}
	</style>
</head>
<body>
	<div id="dx"></div>
</body>
</html>
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
<script>
	var myCaptcha = _dx.Captcha(document.getElementById('dx'), {
		appId: '36fdcf220f434585762dc992c0a50dfc', 
		apiServer: 'https://cap.dingxiang-inc.com',
		success: function(token) {
			// let i = document.location.search.indexOf("?")
			let reslut = document.location.search
			let idIndex = reslut.indexOf('id')
			let orderdIndex = reslut.indexOf('order_id')
			let typeIndex = reslut.indexOf('type')
			let paytypeIndex = reslut.indexOf('paytype')
			let id = reslut.slice(idIndex+3,orderdIndex-1)
			let order_id = reslut.slice(orderdIndex+9,typeIndex-1)
			let type = reslut.slice(typeIndex+5,paytypeIndex-1)
			let paytype = reslut.slice(paytypeIndex+8,reslut.length)
			// let result = document.location.search
			// let id = result.slice(4,idIndex)
			// let paytype = result.slice(idIndex+9,result.length)	
			// console.log(token);
			uni.redirectTo({
					url: `/pages/shop/payment?token=${token}&id=${id}&type=${type}&order_id=${order_id}&paytype=${paytype}`, //此处跳转带上token
			});
			// uni.navigateTo({
			// 	url: '/pages/login/code?token='+token, //此处跳转带上token
			// });
		}
		
	})
	myCaptcha.on('verifySuccess', function (security_code) {
	  myCaptcha.reload()
	})
	
</script>